home *** CD-ROM | disk | FTP | other *** search
HTML Component | 2003-02-01 | 3.2 KB | 100 lines |
- <PUBLIC:COMPONENT lightWeight=true>
- <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="load()" />
- <PUBLIC:PROPERTY NAME="enabled" PUT='setEnabled' GET='getEnabled'/>
- <PUBLIC:PROPERTY NAME="text" />
- <PUBLIC:PROPERTY NAME="image" />
- <PUBLIC:PROPERTY NAME="code" />
- <PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="mouseout()" />
- <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="mouseover()" />
- <PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="clickIt()" />
- <PUBLIC:ATTACH EVENT="onmouseup" ONEVENT="clicked()" />
- <PUBLIC:METHOD NAME="colorChange" />
-
- <SCRIPT LANGUAGE="JScript">
-
- var iEnabled = 1, fLoaded = false;
- var aEnabled = new Array('#d6d6d6', 'white');
- var aImgExt = new Array('dis', 'def', 'hvr', 'dwn');
-
- var ex;
-
- function load()
- {
- ex = window.external;
- if (!ex.appColorLight)
- {
- ex = new Object;
- ex.appColorButtonHoverFace = 'red';
- ex.appColorButtonShadow = 'orange';
- ex.appColorButtonHighlight = 'purple';
- }
-
- var s = '<table title="' + text + '" style="cursor:default; border:1 solid; border-color: ' + getCurrentColor() + '" id="' + element.uniqueID + 'button" border=0 height=22 cellpadding=0 cellspacing=0><tr>';
- s += '<td width=2></td><td><img height=15 align=absmiddle border=0 id="' + element.uniqueID + 'img" src="nav\\' + image + '-' + aImgExt[iEnabled] + '.gif"></td><td width=4></td>';
- s += '<td nowrap class=smtext id="' + element.uniqueID + 'text"><a href="X" onclick="return false" id="' + element.uniqueID + 'link" style="color:' + aEnabled[iEnabled] + '" class=smtext>' + text + '</a></td><td width=6></td>';
- element.innerHTML = s + '</tr></table></td></tr></table>';
- fLoaded = true;
- }
-
- function setEnabled(iE)
- {
- if (iE == 0)
- iEnabled = 0;
- else
- iEnabled = 1;
-
- if (fLoaded)
- element.document.all(element.uniqueID + 'link').style.color = aEnabled[iEnabled];
- }
-
- function getEnabled() { return iEnabled; }
-
- var fOver = false;
- function mouseout()
- {
- fOver = false;
- var sty = element.document.all(element.uniqueID + 'button').style
- sty.backgroundColor = getCurrentColor();
- sty.borderColor = getCurrentColor();
- element.document.all(element.uniqueID + 'img').src = 'nav\\' + image + '-' + aImgExt[iEnabled] + '.gif';
- }
-
-
- function mouseover()
- {
- if (iEnabled)
- {
- fOver = true;
- var but = element.document.all(element.uniqueID + 'button')
- but.style.backgroundColor = ex.appColorButtonHoverFace;
- but.style.borderColor = ex.appColorButtonHighlight + ' ' + ex.appColorButtonShadow + ' ' + ex.appColorButtonShadow + ' ' + ex.appColorButtonHighlight;
- element.document.all(element.uniqueID + 'img').src = 'nav\\' + image + '-' + aImgExt[2] + '.gif';
- }
- }
-
- function clickIt()
- {
- if (iEnabled)
- {
- var but = element.document.all(element.uniqueID + 'button')
- element.document.all(element.uniqueID + 'img').src = 'nav\\' + image + '-' + aImgExt[3] + '.gif';
- but.style.borderColor = ex.appColorButtonShadow + ' ' + ex.appColorButtonHighlight + ' ' + ex.appColorButtonHighlight + ' ' + ex.appColorButtonShadow;
- }
- }
-
- function clicked()
- {
- }
-
- function colorChange()
- {
- if (!fOver)
- {
- var sty = element.document.all(element.uniqueID + 'button').style
- sty.backgroundColor = getCurrentColor();
- sty.borderColor = getCurrentColor();
- }
- }
- </SCRIPT>
- </PUBLIC:COMPONENT>
-